﻿using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Simple.Services;
using Simple.Services.System.QHSEViolationCategory.Models;

namespace Simple.WebApi.Controllers.System;

/// <summary>
/// 条款对应
/// </summary>
[Route("QHSEViolationClauseAssocition/[action]")]
[ApiController]
public class QHSEViolationClauseAssocitionController : ControllerBase
{
    private readonly QHSEViolationClauseAssocitionService _violationClauseAssocitionService;

    public QHSEViolationClauseAssocitionController(QHSEViolationClauseAssocitionService vioaltionClauseAssocitionService)
    {
        _violationClauseAssocitionService = vioaltionClauseAssocitionService;
    }
    /// <summary>
    /// 列表
    /// </summary>
    [HttpGet]
    [CustomAuthorize("hdv_qhse_data")]
    public async Task<AppResult> List()
    {
        List<QHSEViolationClauseAssocitionModel> menus = await _violationClauseAssocitionService.GetAsync();
        return AppResult.Status200OK(data: menus);
    }
    [HttpGet]
    [ValidateTimestampAndSignature]
    public async Task<AppResult> List1()
    {
        List<QHSEViolationClauseAssocitionModel> menus = await _violationClauseAssocitionService.GetAsync();
        return AppResult.Status200OK(data: menus);
    }
    /// <summary>
    /// 查询
    /// </summary>
    [HttpPost]
    [CustomAuthorize("hdv_qhse_data")]
    public async Task<AppResult> ClausResult([FromBody]IdInputModel idInput)
    {
        var data = await _violationClauseAssocitionService.GetClauseResult(idInput);
        return AppResult.Status200OK(data: data);
    }
    [HttpPost]
    [ValidateTimestampAndSignature]
    public async Task<AppResult> ClausResult1([FromBody] IdInputModel idInput)
    {
        var data = await _violationClauseAssocitionService.GetClauseResult(idInput);
        return AppResult.Status200OK(data: data);
    }

}
